var faceConfig = {
    url: "http://s.zbjimg.com/ubb/xheditor_emot/default/",
    item: {
        "1": "生气",
        "2": "吃饭",
        "3": "疑问(微笑)",
        "4": "打针",
        "5": "大哭",
        "6": "拳击",
        "7": "投降",
        "8": "俯卧撑",
        "9": "疑问(不解)",
        "10": "发财",
        "11": "瞌睡",
        "12": "打酱油",
        "13": "憨笑",
        "14": "吃西瓜",
        "15": "汗",
        "16": "惊恐",
        "17": "中标",
        "18": "翻墙",
        "19": "摇头",
        "20": "念经",
        "21": "害羞",
        "22": "睡觉",
        "23": "勤奋",
        "24": "真棒",
        "25": "偷笑",
        "26": "听音乐",
        "27": "晕"
    },
    subname: ".gif"
};
$.ajaxSetup({
    global: false,
    cache: false,
    dataType: "json",
    type: "POST",
    contentType: "application/x-www-form-urlencoded; charset=UTF-8",
    async: true,
    timeout: 14000
});
jQuery.cookie = function(G, H, L) {
    if (typeof H != "undefined") {
        L = L || {};
        if (H === null) {
            H = "";
            L.expires = -1
        }
        var F = "";
        if (L.expires && (typeof L.expires == "number" || L.expires.toUTCString)) {
            var B;
            if (typeof L.expires == "number") {
                B = new Date();
                B.setTime(B.getTime() + (L.expires * 24 * 60 * 60 * 1000))
            } else B = L.expires;
            F = "; expires=" + B.toUTCString()
        }
        var I = L.path ? "; path=" + L.path: "",
        J = L.domain ? "; domain=" + L.domain: "",
        A = L.secure ? "; secure": "";
        document.cookie = [G, "=", encodeURIComponent(H), F, I, J, A].join("")
    } else {
        var C = null;
        if (document.cookie && document.cookie != "") {
            var K = document.cookie.split(";");
            for (var D = 0; D < K.length; D++) {
                var E = jQuery.trim(K[D]);
                if (E.substring(0, G.length + 1) == (G + "=")) {
                    C = decodeURIComponent(E.substring(G.length + 1));
                    break
                }
            }
        }
        return C
    }
};
function getRandom() {
    return String(Math.ceil(Math.random() * 100000) + String(new Date().getTime()))
}
function setCaretTo(B, C) {
    if (B.createTextRange) {
        var A = B.createTextRange();
        A.move("character", C);
        A.select()
    } else if (B.selectionStart) {
        B.focus();
        B.setSelectionRange(C, C)
    }
}
function eventSrc() {
    if (window.event) return window.event;
    src = eventSrc.caller;
    while (src) {
        var A = src.arguments[0];
        if (A) {
            if ((A.constructor == Event || A.constructor == MouseEvent) || (typeof(A) == "object" && A.preventDefault && A.stopPropagation)) return A
        } else src = src.caller
    }
    return null
}
function addToFavorite(A, C) {
    if (!A || !C) {
        alert("addToFavorite Error: 加入收藏夹必须填入正确的title以及href");
        return
    }
    try {
        if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel(A, C, "");
        else window.external.AddFavorite(C, A)
    } catch(B) {
        alert("加入收藏夹: 您的浏览器不支持该操作,请手动复制网址加入收藏夹")
    }
}
function copyTextButton(A, B) {}
copyTextButton.hasLoaded = false;
copyTextButton.setLoaded = function() {};
copyTextButton.complete = null;
function mouse() {
    var A = eventSrc();
    if (!A.pageX) {
        x = A.clientX + document.documentElement.scrollLeft;
        y = A.clientY + document.documentElement.scrollTop
    } else {
        x = A.pageX;
        y = A.pageY
    }
    return {
        "x": x,
        "y": y
    }
}
function bindKeyWord(G, D, J) {
    var H = B(G || "js-keysWord-light-"),
    K = document.referrer,
    A = I(K),
    F = P(K),
    E = 0,
    L = null,
    N = {
        searchUrl: "http://search.zhubajie.com/task-list.html?qc=",
        bgColor: D || "#ffea00",
        ftColor: J || "#ff0000"
    };
    if (H.length == 0 || A == null || A == "null" || F == null || F == "null") return false;
    if (!F.length || F.length < 1) return;
    M(C);
    function C() {
        for (var B = 0; B < H.length; B++) for (var A = 0; A < F.length; A++) {
            L = RegExp(F[A], "g");
            H[B].html(H[B].html().replace(L, "<em style=\"background:" + N.bgColor + ";color:" + N.ftColor + ";font-style:normal\">" + F[A] + "</em>"))
        }
        O()
    }
    function B(B) {
        var A = 0,
        D = new Array(),
        C = true;
        while (C != null) {
            C = document.getElementById(B + A);
            if (C != null) {
                D.push($(C));
                A++
            }
        }
        return D
    }
    function I(A) {
        var B = A.match(/(?:(?:baidu)|(?:google)|(?:soso)).+?(?=\/)/);
        return String(B).replace(/\..*/, "")
    }
    function P(B) {
        if (A == null) return null;
        var C = null;
        if (A == "baidu") C = B.match(/[\?&]?wd\=(.+)/)[1];
        if (A == "google") C = B.match(/[\?&]?q\=(.+)/)[1];
        if (A == "soso") C = B.match(/[\?&]?w\=(.+)/)[1];
        C = String(C).replace(/&.*/, "");
        return C.split("+")
    }
    function M(B) {
        $.getJSON("http://quan.zhubajie.com/getwords.php?jsoncallback=?", {
            site: A,
            keys: F.join(" ")
        },
        function(A) {
            F = A.keys.split(" ");
            E = A.count || 100;
            B()
        })
    }
    function O() {
        at_fboxUse.show("您从搜索引擎进入", "<div class=\"keyword-fbox\"><p class=\"mb10 cot\">猪八戒网共有 <font>" + E + "</font> 个包含 <font>" + F + "</font> 的任务。<a href=\"" + N.searchUrl + encodeURI(F.join("+")) + "\" class=\"more\" target=\"_blank\">查看更多相关任务</a></p><s></s><a href=\"http://task.zhubajie.com/post\" class=\"at_but b_1_y\"><u></u>我有需求，发布任务</a></div>", 260, 200)
    }
}
function at_userData() {
    var userid = $.cookie("userid");
    if (userid == null || !userid) return null;
    else return {
        regtime: $.cookie("userregtime"),
        key: $.cookie("userkey"),
        nickname: $.cookie("nickname"),
        id: userid
    }
}
var at_loading = function() {
    this.html = "<div id=\"at_loading\"><s></s></div>";
    $("body").append(html);
    at_loading.loading = $("#at_loading");
    at_loading.hasInit = true
};
at_loading.ldmsg = "<div class=\"at_loading_c\">正在处理请求，请等候...</div>";
at_loading.demsg = "<div class=\"at_loading_b\">{lite:msg}</div>";
at_loading.loading = null;
at_loading.hasInit = false;
at_loading.setCenter = function() {
    var A = ((jQuery(window).width() - at_loading.loading.outerWidth()) / 2) + jQuery(window).scrollLeft(),
    B = ((jQuery(window).height() - at_loading.loading.outerHeight()) / 2) + jQuery(window).scrollTop();
    at_loading.loading.css({
        "left": A,
        "top": B
    })
};
at_loading.show = function(msg) {
    if (at_loading.hasInit == false) at_loading();
    var B;
    if (!msg) B = at_loading.ldmsg;
    else B = at_loading.demsg.replace("{lite:msg}", msg);
    at_loading.loading.prepend(B);
    at_loading.setCenter();
    at_loading.loading.css({
        "visibility": "visible",
        "opacity": 0
    });
    at_loading.loading.animate({
        "opacity": 1
    },
    100)
};
at_loading.hide = function() {
    if (at_loading.hasInit == false) at_loading();
    at_loading.loading.animate({
        "opacity": 0
    },
    100, null, 
    function() {
        at_loading.loading.css("visibility", "hidden")
    })
};
at_loading.getDisplayState = function() {
    if (at_loading.loading.css("visibility") == "hidden") return false;
    return true
};
var at_fbox = function() {
    if (at_fbox._initState_ == true) return this;
    at_fbox._initState_ = true;
    this.window = jQuery(window);
    this.body = jQuery("body:eq(0)");
    this.container = "<div id=\"at_fbox\"><div class=\"at_fbox_t\"><span>提示信息</span><a href=\"javascript:void()\"></a></div><div class=\"at_fbox_c\"></div></div>";
    this.c = {
        bottomMargin: 3,
        rightMargin: 3,
        allPadding: 1,
        width: 260,
        height: 200,
        titleHeight: 0,
        availWidth: this.window.width(),
        availHeight: this.window.height(),
        scrollLeft: this.window.scrollLeft(),
        scrollTop: this.window.scrollTop(),
        display: "hide",
        showTop: 0,
        hideTop: 0
    };
    this.title = null;
    this.close = null;
    this.content = null;
    this.body.append(this.container);
    this.eventOutTime = null;
    this.eventHasBind = false;
    var A = this;
    this.eventOutTime = window.setTimeout(function() {
        window.clearTimeout(A.eventOutTime);
        A.eventOutTime = null;
        A.init()
    },
    1000)
};
at_fbox._initState_ = false;
at_fbox.prototype = {
    init: function() {
        this.container = $("#at_fbox");
        var A = this.container.children(".at_fbox_t");
        this.title = A.find("span");
        this.close = A.find("a");
        this.content = this.container.children(".at_fbox_c");
        this.content.css("marginLeft", this.c.allPadding);
        this.c.titleHeight = this.title.parent().outerHeight();
        this.setSize();
        this.setPosition()
    },
    bindEvent: function(E) {
        var F = this;
        if (!this.eventHasBind) {
            this.close.bind("click", D);
            this.window.bind("resize", A);
            this.eventHasBind = true
        }
        try {
            if (E == "show") this.window.bind("scroll", C);
            else this.window.unbind("scroll", C)
        } catch(B) {}
        function C() {
            F.setPosition(true)
        }
        function D() {
            F.setDisplay("hide");
            return false
        }
        function A() {
            F.c.availWidth = F.window.width();
            F.c.availHeight = F.window.height();
            F.setPosition()
        }
    },
    setPosition: function(C) {
        var A = (C) ? 350: 0,
        B = this;
        this.eventOutTime = window.setTimeout(function() {
            B.c.scrollLeft = B.window.scrollLeft();
            B.c.scrollTop = B.window.scrollTop();
            B.c.hideTop = (B.c.availHeight - B.c.height) + B.c.scrollTop + B.c.height - B.c.bottomMargin;
            B.c.showTop = (B.c.availHeight - B.c.height) + B.c.scrollTop - B.c.bottomMargin;
            B.container.css({
                top: (B.c.display == "hide") ? B.c.hideTop: B.c.showTop,
                left: (B.c.availWidth - B.c.width) + B.c.scrollLeft - B.c.rightMargin
            });
            window.clearTimeout(B.eventOutTime);
            B.eventOutTime = null
        },
        A)
    },
    setSize: function(C, B) {
        if (this.eventOutTime != null) {
            var D = this,
            A = window.setTimeout(function() {
                window.clearTimeout(A);
                D.setSize(C, B)
            },
            300);
            return
        }
        if (C) {
            this.c.width = C;
            this.container.width(C);
            this.content.width(this.c.width - (this.c.allPadding * 2))
        } else this.container.width(this.c.width);
        if (B) {
            this.c.height = B;
            this.container.height(B);
            this.content.height(this.c.height - this.c.titleHeight - this.c.allPadding)
        } else this.container.height(this.c.height);
        if (C || B) this.setPosition()
    },
    setContent: function(C, B) {
        if (this.eventOutTime != null) {
            var D = this,
            A = window.setTimeout(function() {
                window.clearTimeout(A);
                D.setContent(C, B)
            },
            300);
            return
        }
        if (C) this.title.html(C);
        if (B) this.content.html(B)
    },
    setDisplay: function(C, D) {
        if (C == this.c.display) return;
        var B = this;
        if (this.eventOutTime != null) {
            var A = window.setTimeout(function() {
                window.clearTimeout(A);
                B.setDisplay(C, D)
            },
            300);
            return
        }
        if (D) {
            A = window.setTimeout(function() {
                window.clearTimeout(A);
                B.setDisplay(C)
            },
            D);
            return
        } else switch (C) {
        case "show":
            this.bindEvent("show");
            this.container.css("visibility", "visible");
            this.container.stop();
            this.container.animate({
                opacity: 1,
                top: this.c.showTop
            },
            null, 
            function() {
                B.c.display = "show";
                try {
                    B.onShow()
                } catch(A) {}
            });
            break;
        case "hide":
            this.bindEvent("hide");
            this.container.stop();
            this.container.animate({
                opacity:
                0,
                top: this.c.hideTop
            },
            null, 
            function() {
                B.c.display = "hide";
                B.container.css("visibility", "hidden");
                try {
                    B.onHide()
                } catch(A) {}
            });
            break
        }
    },
    getThis: function() {
        return this.content
    }
};
var at_tips = function() {
    this.body = jQuery("body:eq(0)");
    this.container = "<div id=\"at_temp_tipsCreateId\" class=\"at_tips\"><span class=\"at_tips_p\"></span><p class=\"at_tips_t\"><a href=\"javascript:void(0)\" class=\"at_tips_b\"></a><a href=\"javascript:void(0)\" class=\"at_tips_g\"></a></p><div class=\"at_tips_c\"></div><div class=\"at_tips_s\"></div></div>";
    this.close = null;
    this.edits = null;
    this.arrow = null;
    this.contact = null;
    this.shadow = null;
    this.body.append(this.container);
    this.init()
};
at_tips.prototype = {
    init: function() {
        this.container = $("#at_temp_tipsCreateId");
        this.container.removeAttr("id");
        var A = this.container.find("a");
        this.edits = A.filter(".at_tips_b");
        this.close = A.filter(".at_tips_g");
        this.arrow = this.container.find("span.at_tips_p");
        this.contact = this.container.find("div.at_tips_c");
        this.shadow = this.container.find("div.at_tips_s");
        this.resetShadow();
        this.bindEvent()
    },
    bindEvent: function() {
        var A = this;
        this.close.click(function() {
            A.setDisplay("hide");
            return false
        })
    },
    setDisplay: function(B) {
        if (B == "show") {
            this.container.css("visibility", "visible");
            try {
                this.onHide()
            } catch(A) {}
        } else if (B == "hide") {
            this.container.css("visibility", "hidden");
            try {
                this.onHide()
            } catch(A) {}
        }
    },
    setWidth: function(A) {
        if (typeof A == "number") {
            this.container.width(A);
            this.contact.width(A - (parseInt(this.contact.css("margin-left").replace(/[^0-9]/g, "")) * 2));
            this.resetShadow()
        }
    },
    setPosition: function(B, A) {
        if (typeof B == "number") this.container.css("left", B);
        if (typeof A == "number") this.container.css("top", A)
    },
    setArrowAlign: function(A) {
        var B = "15%";
        if (A == "left") B = "15%";
        if (A == "center") B = "46%";
        if (A == "right") B = "75%";
        this.arrow.css("left", B)
    },
    setContact: function(A) {
        if (typeof(A) == "string" || A == "") this.contact.html(A);
        else if (A.attr("tagName") != "undefined" || A.attr("tagName") != null || !A.attr("tagName")) this.contact.append(A);
        this.resetShadow()
    },
    setToolsDisplay: function(D, B, C) {
        var A;
        if (D == "edit") A = this.edits;
        else if (D == "close") A = this.close;
        else return;
        if (B == "show") A.css("display", "inline-block");
        else if (B == "hide") A.css("display", "none");
        if (C instanceof Function) A.bind("click", C)
    },
    append: function(A) {
        if (!A || A.length != 1) return;
        A.append(this.container)
    },
    resetShadow: function() {
        this.shadow.width(this.container.width());
        this.shadow.height(this.container.height())
    }
};
var at_tipsUse = function(C, B, A, E, D) {
    if (at_tipsUse.hasInit == false) {
        at_tipsUse.i = new at_tips();
        at_tipsUse.hasInit = true
    }
    if (C) at_tipsUse.i.append(C);
    if (B) at_tipsUse.i.setContact(B);
    if (A) at_tipsUse.i.setWidth(A);
    if (E && E instanceof Array && E.length == 2) at_tipsUse.i.setPosition(E[0], E[1]);
    if (D) at_tipsUse.i.setArrowAlign(D)
};
at_tipsUse.i = null;
at_tipsUse.hasInit = false;
at_tipsUse.show = function(C, B, A, E, D) {
    at_tipsUse(C, B, A, E, D);
    at_tipsUse.i.setDisplay("show")
};
at_tipsUse.hide = function() {
    at_tipsUse.i.setDisplay("hide")
};
var at_fboxUse = function(B, C, A, D) {
    at_fboxUse.i = new at_fbox();
    at_fboxUse.i.setContent(B, C);
    at_fboxUse.i.setSize(A, D)
};
at_fboxUse.i = null;
at_fboxUse.show = function(C, D, A, E, B) {
    at_fboxUse(C, D, A, E);
    at_fboxUse.i.setDisplay("show", B)
};
at_fboxUse.hide = function(A) {
    at_fboxUse.i.setDisplay("hide", A)
};
var at_star = function(A) {
    if (!A instanceof jQuery) return;
    this.item = A;
    this.init();
    this.bindEvent()
};
at_star.prototype = {
    init: function() {
        var A,
        B = this;
        this.item.each(function() {
            A = $(this);
            B.setDefault(A);
            B.bindEvent(A)
        })
    },
    bindEvent: function(A) {
        if (!A) return;
        var D,
        B,
        C = this;
        D = A.children("*");
        D.mouseover(function() {
            B = D.index(this);
            C.setHover(D, B)
        }).click(function() {
            B = D.index(this) + 1;
            try {
                C.onSelected(A, B)
            } catch(E) {}
        });
        A.mouseleave(function() {
            C.setDefault(A)
        })
    },
    setHover: function(C, A) {
        var B;
        C.each(function() {
            B = C.index(this);
            if (B < A + 1) C.eq(B).addClass("at_selected");
            else C.eq(B).removeClass("at_selected")
        })
    },
    setDefault: function(A) {
        var C = A.children("*"),
        B = A.attr("starNumber");
        if (B) {
            C.removeClass("at_selected");
            C.filter("*:lt(" + B + ")").addClass("at_selected")
        } else A.attr("starNumber", 0)
    }
};
var traceList = [],
at_trace = function() {
    traceList.push(this);
    var A = at_trace.getKey();
    this.randomId = A.key;
    this.guidIndex = A.index;
    this.body = jQuery("body:eq(0)");
    this.container = "<div id=\"at_trace_w" + this.randomId + "\" class=\"at_trace_w\"><div class=\"at_trace_c\"><div class=\"at_trace_t\"><a class=\"at_trace_s\" href=\"javascript:void(0)\"></a><h2>标题</h2></div><div class=\"at_trace_cont\"></div><div class=\"at_trace_b\"></div></div></div>";
    if (at_trace.mask == null) {
        at_trace.mask = "<div id=\"at_trace_m\" class=\"at_trace_m\">" + (($.browser.version == "6.0") ? "<iframe></iframe>": "") + "</div>";
        this.trace = at_trace.mask + this.container
    } else this.trace = this.container;
    this.body.prepend(this.trace);
    this.title = null;
    this.contact = null;
    this.buttons = null;
    this.close = null;
    this.width = 200;
    this.init()
};
at_trace.mask = null;
at_trace.maskDisplay = function(A) {
    if (A == "hide") {
        for (var B = 0; B < at_trace.guid.length; B++) if (at_trace.guid[B].display == "show") return;
        at_trace.mask.animate({
            "opacity": 0
        },
        150, null, 
        function() {
            at_trace.mask.css("visibility", "hidden")
        })
    } else if (A == "show") {
        if (at_trace.mask.css("visibility") == "visible") return;
        at_trace.mask.css({
            "visibility": "visible",
            "opacity": 0
        });
        at_trace.mask.animate({
            "opacity": 0.5
        },
        150)
    }
};
at_trace.guid = [];
at_trace.getKey = function() {
    var B = getRandom(),
    A = at_trace.guid.length;
    while (at_trace.checkKey(B)) B = getRandom();
    at_trace.guid[A] = {
        key: B,
        display: "hide"
    };
    return {
        key: B,
        index: A
    }
};
at_trace.checkKey = function(A) {
    for (var B = 0; B < at_trace.guid.length; B++) if (at_trace.guid[B].key == A) return true;
    return false
};
at_trace.prototype = {
    init: function() {
        var D,
        C;
        at_trace.mask = this.body.find("#at_trace_m");
        this.trace = this.body.find("#at_trace_w" + this.randomId);
        D = this.trace.children(".at_trace_c");
        C = D.children(".at_trace_t");
        this.title = C.children("h2");
        this.close = C.children("a.at_trace_s");
        this.contact = D.children("div.at_trace_cont");
        this.buttons = D.children("div.at_trace_b");
        var B = this,
        A;
        this.close.click(function() {
            B.setDisplay("hide");
            return false
        });
        if (at_trace.guid.length == 1) this.initMaskStyle();
        /*$(window).bind("scroll", 
        function() {
            B.setCenter()
        }).resize(function() {
            B.initMaskStyle();
            B.setCenter()
        })*/
    },
    initMaskStyle: function() {
        var C = jQuery(window),
        B = (this.body.width() < C.width()) ? C.width() : this.body.width();
        at_trace.mask.css("display", "none");
        var A = C.height();
        at_trace.mask.css("display", "block");
        //at_trace.mask.width(B);
        at_trace.mask.width('100%');
        //at_trace.mask.height(A);
        at_trace.mask.height('100%');
        at_trace.mask.css("opacity", 0.5)
    },
    setCenter: function() {
        var D = jQuery(window),
        B = ((this.body.width() - this.trace.outerWidth()) / 2) + D.scrollLeft(),
        C = ((D.height() - this.trace.outerHeight()) / 2) + D.scrollTop(),
        A = D.scrollTop();
        this.trace.css({
            "left": B,
            "top": C
        });
        at_trace.mask.css("top", A)
    },
    setDisplay: function(B) {
        var A = this;
        if (B == "hide" || B == "show") {
            at_trace.mask.stop(false, true);
            this.trace.stop(false, true);
            at_trace.guid[this.guidIndex].display = B;
            at_trace.maskDisplay(B);
            if (B == "hide") this.trace.animate({
                "opacity": 0
            },
            150, null, 
            function() {
                $(this).css("visibility", "hidden");
                try {
                    A.onHide()
                } catch(B) {}
            });
            else if (B == "show") {
                this.setCenter();
                this.trace.css({
                    "visibility": "visible",
                    "opacity": 0
                });
                this.trace.animate({
                    opacity: 1
                },
                150, 
                function() {
                    try {
                        A.onShow()
                    } catch(B) {}
                })
            }
        }
    },
    setContact: function(B, E, C) {
        var A = "",
        D = "";
        if (B) this.title.html(B);
        if (E) this.contact.html(E);
        if (C) {
            for (var F = 0; F < C.length; F++) A += C[F].html + (((F + 1) == C.length) ? "": " ");
            this.buttons.html(A);
            this.bindEvent(C)
        }
        this.setCenter()
    },
    setTitle: function(A) {
        if (A) this.title.html(A)
    },
    appendContact: function(A) {
        this.contact.html("");
        this.contact.append(A);
        this.setCenter()
    },
    bindEvent: function(B) {
        var C = this.buttons.find("a"),
        A,
        D = this;
        C.click(function() {
            A = C.index(this);
            if (B[A].callBack == "close") D.setDisplay("hide");
            else B[A].callBack();
            return false
        })
    },
    setWidth: function(A) {
        this.trace.find("div.at_trace_c").width(A);
        this.setCenter()
    },
    getButton: function(A, B, D) {
        if (!A || !B) return null;
        if (B == "blue" || B == "yellow" || B == "gray") var B = /^.?/.exec(B),
        C = "<a href=\"javascript:void(0)\" class=\"at_but b_2_" + B + "\"><u></u>" + A + "</a>";
        else if (B == "href") C = "<a href=\"javascript:void(0)\" class=\"at_txthref\">" + A + "</a>";
        return {
            "html": C,
            "callBack": D
        }
    },
    setDefaultCloseDisplay: function(B) {
        var A = this.getThis().find("a.at_trace_s");
        if (B == "hide") A.hide();
        else A.show()
    },
    setDefaultButtonDisplay: function(A) {
        if (A == "hide") this.buttons.hide();
        else this.buttons.show();
        this.setCenter()
    },
    getThis: function() {
        return $("#at_trace_w" + this.randomId)
    }
};
var at_traces_i = at_trace.prototype,
at_infoTrace = function() {
    at_traces_i = new at_trace();
    at_traces_i.setWidth(350);
    at_traces_i.setContact("系统提示", null, [at_traces_i.getButton("确定", "gray", "close")]);
    at_traces_i.getThis().addClass("at_trace_w_i");
    at_traces_i.onShow = function() {
        try {
            at_infoTrace.onShow()
        } catch(A) {}
    };
    at_traces_i.onHide = function() {
        try {
            at_infoTrace.onHide()
        } catch(A) {}
    }
};
at_infoTrace._timer = null;
at_infoTrace.hasInit = false;
at_infoTrace.show = function(C, E, B, A, D) {
    if (at_infoTrace.hasInit == false) {
        at_infoTrace();
        at_infoTrace.hasInit = true
    }
    var E = E || "i";
    at_traces_i.setContact(null, "<div class=\"at_trace_if clearfix\"><u class=\"at_msg m_1_" + E + "\"></u><p class=\"at_trace_if_c " + (D ? "": "m10") + " ml15\">" + C + "</p></div>", ((A) ? A: [at_traces_i.getButton("确定", "gray", "close")]));
    at_traces_i.setDisplay("show");
    if (B && /^[0-9]*$/.test(B)) at_infoTrace._timer = window.setTimeout(function() {
        window.clearTimeout(at_infoTrace._timer);
        at_infoTrace.hide()
    },
    B)
};
at_infoTrace.hide = function() {
    at_traces_i.setDisplay("hide");
    window.clearTimeout(at_infoTrace._timer)
};
var at_select = function(A) {
    if (!A) return;
    this.Menu = $("#" + A);
    if (this.Menu.length != 1) return;
    this.Item = this.Menu.find("a");
    this.Selected = this.Item.filter(".at_selected");
    this.Item = this.Item.not(".at_selected");
    this.Value = this.Menu.find("input");
    this.timer = false;
    this.bindEvent()
};
at_select.prototype = {
    bindEvent: function() {
        var B,
        A = this;
        this.Menu.hover(function() {
            if (A.timer) return;
            A.timer = window.setTimeout(function() {
                A.setDisplay("show")
            },
            200)
        },
        function() {
            window.clearTimeout(A.timer);
            A.timer = false;
            A.setDisplay("hide")
        });
        this.Item.click(function() {
            A.setSelected($(this));
            A.setDisplay("hide")
        })
    },
    setDisplay: function(A) {
        if (A == "show") this.Item.css("display", "block");
        if (A == "hide") this.Item.css("display", "none")
    },
    setSelected: function(B) {
        var C = B.attr("value");
        this.Selected.html(B.html());
        this.Value.val(C);
        try {
            this.onSelected(C)
        } catch(A) {}
    }
};
var at_scroll = function(A, B, C) {
    if (!A || !B || !(B == "x" || B == "y") || (C > 10000 || C < 0)) return;
    this.dir = B;
    this.con = $("#" + A);
    this.ani = this.con.children("div.at_scroll_c");
    if (this.con.length != 1) return;
    this.tem = this.ani.children("*");
    this.copyTem = null;
    this.continueState = true;
    this.config = {
        count: 0,
        showPx: 0,
        pagePx: 0,
        itemPx: 0,
        index: 0,
        nowPx: 0,
        casePx: 0
    };
    this.timer = null;
    this.mouseState = false;
    this.state = false;
    this.timeout = parseInt(C || 2000);
    this.init()
};
at_scroll.prototype = {
    init: function() {
        this.config.count = this.tem.length;
        this.config.showPx = (this.dir == "y") ? this.con.height() : this.con.width();
        this.config.itemPx = (this.dir == "y") ? this.tem.eq(0).outerHeight() : this.tem.eq(0).outerWidth();
        this.config.pagePx = this.config.itemPx * this.config.count;
        if (this.dir == "y") {
            this.con.scrollTop(0);
            this.ani.height(this.config.pagePx * 2)
        } else {
            this.con.scrollLeft(0);
            this.ani.width(this.config.pagePx * 2)
        }
        this.copyTem = this.tem.clone(true);
        this.ani.append(this.copyTem);
        this.config.casePx = this.config.pagePx - ((this.timeout > 149) ? this.config.itemPx: 1);
        if (this.config.pagePx <= this.config.showPx) return;
        this.bindEvent();
        this.auto()
    },
    bindEvent: function() {
        var A = this;
        A.con.bind("mouseenter", 
        function() {
            window.clearTimeout(A.timer);
            A.timer = false;
            A.mouseState = true
        });
        A.con.bind("mouseleave", 
        function() {
            A.auto();
            A.mouseState = false
        })
    },
    auto: function(A) {
        var B = this,
        C;
        if (this.state == true) return;
        C = (A) ? 0: this.timeout;
        this.timer = window.setTimeout(function() {
            window.clearTimeout(B.timer);
            B.timer = false;
            B.move()
        },
        C)
    },
    move: function() {
        var A = false;
        if (this.config.nowPx == this.config.casePx) A = true;
        this.animate(A)
    },
    animate: function(toFrist) {
        var me = this;
        this.state = true;
        if (this.timeout > 149) {
            this.config.index++;
            this.config.nowPx = this.config.itemPx * this.config.index;
            this.con.stop();
            eval("this.con.animate({\"" + ((this.dir == "y") ? "scrollTop": "scrollLeft") + "\": this.config.nowPx}, 800, null, complete)")
        } else {
            this.config.nowPx++;
            if (me.dir == "y") me.con.scrollTop(this.config.nowPx);
            else me.con.scrollLeft(this.config.nowPx);
            complete()
        }
        function complete() {
            me.state = false;
            if (me.mouseState == false) me.auto();
            if (toFrist != true) return;
            if (me.dir == "y") me.con.scrollTop(0);
            else me.con.scrollLeft(0);
            me.config.index = 0;
            me.config.nowPx = 0
        }
    }
};
var at_tab = function(A, C, B) {
    if (!A) return;
    this.con = $("#" + A);
    this.tag = this.con.children(".at_tab_t").children(".at_tab_i");
    this.lay = this.con.children(".at_tab_c").children(".at_tab_l");
    if (this.tag.length != this.lay.length) return;
    this.oldIndex = null;
    if (C) {
        this.eventMode = "click";
        this.ajaxMode = true
    } else {
        this.eventMode = "mouseover";
        this.ajaxMode = false
    }
    this.timer = null;
    this.outime = (this.ajaxMode) ? 0: 270;
    this.loadState = false;
    this.init()
};
at_tab.prototype = {
    init: function() {
        var C = this,
        A = true,
        B = 0;
        this.tag.each(function() {
            if ($(this).hasClass("at_current")) {
                C.oldIndex = C.tag.index(this);
                C.lay.eq(C.oldIndex).css("display", "block")
            }
        });
        if (this.ajaxMode) {
            this.tag.each(function() {
                if (!$(this).attr("ajaxsrc")) B++
            });
            if (B != this.tag.length) {
                this.tag.each(function() {
                    if (!$(this).attr("ajaxsrc")) {
                        alert("at_tab Error: 当前已开启ajax模式,名为\"" + $(this).text() + "\"的选项卡标签必须带有ajaxsrc属性来描述请求地址");
                        A = false
                    }
                });
                if (A == false) return
            } else this.ajaxMode = false
        }
        this.bindEvent()
    },
    bindEvent: function() {
        var B = this,
        A;
        this.tag.bind(this.eventMode, 
        function() {
            if (B.ajaxMode) $(this).unbind("mouseout");
            B.switchTab(B.tag.index(this))
        });
        this.tag.bind("mouseout", 
        function() {
            B.loadState = false;
            window.clearTimeout(B.timer);
            B.timer = null
        })
    },
    switchTab: function(B) {
        if (this.loadState != false) return;
        this.loadState = true;
        var D = this,
        C,
        A,
        E;
        if (B == D.oldIndex || D.timer != null) {
            this.loadState = false;
            return
        }
        this.timer = window.setTimeout(function() {
            C = D.tag.eq(B);
            A = D.lay.eq(B);
            if (D.ajaxMode == true) {
                F();
                E = C.html();
                A.html("<u class=\"at_write m10\"></u>");
                $.ajax({
                    url: C.attr("ajaxsrc"),
                    success: function(B) {
                        A.html("");
                        if (B.state == 1) {
                            A.html(B.msg);
                            C.attr("loaded", "y");
                            G()
                        } else {
                            at_infoTrace.show(B.msg, "i");
                            D.loadState = false
                        }
                    }
                })
            } else {
                F();
                G()
            }
            function F() {
                D.tag.eq(D.oldIndex).removeClass("at_current");
                D.lay.eq(D.oldIndex).css("display", "none");
                C.addClass("at_current");
                A.css("display", "block")
            }
            function G() {
                D.oldIndex = B;
                window.clearTimeout(D.timer);
                D.timer = null;
                D.loadState = false;
                try {
                    D.onLoaded(B, A)
                } catch(C) {}
            }
        },
        this.outime)
    },
    getSelected: function() {
        return this.oldIndex
    }
};
var at_imgSwitch = function(A, E, B) {
    if (!A) return;
    this.container = $("#" + A);
    this.container.css("visibility", "hidden");
    this.cons = this.container.children("ul.at_imgSwitch_c");
    this.team = this.cons.find("li:eq(0)");
    this.page = null;
    this.config = {
        "totalWidth": 0,
        "itemWidth": 0,
        "count": 0,
        "index": 0
    };
    this.timer = null;
    this.mode = E ? true: false;
    this._time = (this.mode && /^[0-9]*$/.test(B)) ? B: 5000;
    var F = this,
    C = (($.browser.safari) ? 500: 0),
    D = window.setTimeout(function() {
        window.clearTimeout(D);
        F.container.css("visibility", "visible");
        F.init()
    },
    C)
};
at_imgSwitch.prototype = {
    init: function() {
        var A = this.cons.find("li");
        A.css({
            width: this.container.width(),
            height: this.container.height()
        });
        this.config.itemWidth = this.team.outerWidth();
        this.config.count = A.length;
        this.config.totalWidth = this.config.itemWidth * this.config.count;
        this.cons.width(this.config.totalWidth);
        this.page = this.createPage();
        this.cons.scrollLeft(0);
        this.setPlaces();
        this.bindEvent();
        var B = this;
        if (this.mode) this.autoStart()
    },
    createPage: function() {
        var A = "<ul class=\"at_imgSwitch_p\">";
        for (var B = this.config.count; B > 0; B--) A += "<li" + ((B - 1 == this.config.index) ? (" class=\"at_current\"") : "") + ">" + (B) + "</li>";
        A += "</ul>";
        this.cons.after(A).find("li");
        return this.container.find("ul.at_imgSwitch_p li")
    },
    setPlaces: function() {
        var A,
        C = 0,
        B = this;
        A = this.page.parent();
        this.page.each(function() {
            C += $(this).outerWidth()
        });
        A.css({
            width: C,
            top: this.container.outerHeight() - A.outerHeight() - 12,
            left: this.container.outerWidth() - C - 12
        })
    },
    bindEvent: function() {
        var B = this,
        A;
        this.page.click(function() {
            A = ((B.config.count - 1) - B.page.index(this));
            B.changeIndex(A)
        })
    },
    changeIndex: function(A) {
        var B = this;
        window.clearTimeout(this.timer);
        this.config.index = A;
        this.page.removeClass("at_current");
        this.page.eq(((this.config.count - 1) - this.config.index)).addClass("at_current");
        this.cons.stop();
        this.cons.animate({
            "left": -(this.config.index * this.config.itemWidth)
        },
        400, null, 
        function() {
            try {
                B.onSwitch(A)
            } catch(C) {}
            if (B.mode) B.autoStart()
        })
    },
    autoStart: function() {
        var B = this,
        A;
        this.timer = window.setTimeout(function() {
            if (B.config.index + 1 < B.config.count) A = B.config.index + 1;
            else A = 0;
            B.changeIndex(A)
        },
        this._time)
    }
};
var at_loginUse = {
    t: null,
    request: function(A, C, B) {
        at_loading.show();
        $.getScript(path + "/resources/js/auntion.login.js", 
        function() {
            at_loading.hide();
            at_loginUse.init();
            if (A || C) at_loginUse.open(A, C, B)
        })
    },
    init: function() {
        at_loginUse.t = new at_login()
    },
    open: function(A, C, B) {
        if (typeof at_login_loaded == "undefined" || !typeof at_login_loaded) {
            at_loginUse.request(A, C, B);
            return
        } else if (at_loginUse.t == null) at_loginUse.init();
        if (!B) at_loginUse.t.openLogin();
        else at_loginUse.t.gotoReg();
        at_loginUse.t.onLoginOk = (A) ? A: null;
        at_loginUse.t.onRegOk = (C) ? C: null
    }
};
function at_loginNeed(A, C, B) {
    at_infoTrace.show("您还没有登陆，不能进行此操作。<br>是否立即登陆?", "i", null, [at_traces_i.getButton("登陆", "yellow", 
    function() {
        if (A || C) at_loginUse.open(A, C, B);
        at_infoTrace.hide()
    }), at_traces_i.getButton("取消", "gray", "close")], true)
}
function at_userInfo(H) {
    if (!H) return;
    var E = F(),
    B = D(),
    C = A();
    function F() {
        var A = "#userinfo-",
        B = 0,
        C = [],
        D = new Array();
        while (C.length == 1 || B == 0) {
            B++;
            C = $(A + B);
            if (C.length == 1) D.push(C);
            else break
        }
        return D
    }
    function A() {
        if (/\?/.test(H)) return H + "&jsoncallback=?";
        else return H + "?jsoncallback=?"
    }
    function D() {
        var A = "";
        for (var B = 0; B < E.length; B++) A += E[B].attr("uid") + ",";
        return A.replace(/\,$/, "")
    }
    function G(A) {
        for (var B = 0; B < E.length; B++) E[B].html(A[B])
    }
    $.getJSON(C, {
        uid: B
    },
    function(A) {
        if (A.state == 1) G(A.msg)
    })
}
var at_sms = function(C) {
    if (at_userData() == null) {
        function B() {
            at_sms(C)
        }
        at_loginNeed(B, B);
        return
    }
    if (at_sms.t == null) {
        var D = "<div id=\"at_sms\" class=\"at_tol_pub\"><p class=\"sms_title\">标　题：<input value=\"输入站内信标题\" maxlength=\"22\"/></p><p class=\"sms_target\">收信人：<input value=\"" + (C ? C: "输入收信人昵称") + "\" maxlength=\"22\"/></p><p class=\"sms_content\"><textarea></textarea></p></div>";
        at_sms.t = new at_trace();
        at_sms.t.setContact("发送站内信", D, [at_sms.t.getButton("发送", "yellow", 
        function() {
            var B = "",
            A = at_sms.c.t.val().replace(/\s/g, ""),
            D = at_sms.c.u.val().replace(/\s/g, ""),
            C = at_sms.c.c.val().replace(/\s/g, "");
            if (A == "输入站内信标题" || A.length < 2 || A.length > 20) B += "标题必须大于2并小于20个字<br>";
            if (D == "输入收信人昵称" || D == "") B += "必须填写至少1个收件人昵称<br>";
            if (C.length < 5 || C.length > 250) B += "内容必须大于5并小于22个字<br>";
            if (B != "") {
                at_infoTrace.show(B, "e", null, [at_sms.t.getButton("返回重填", "yellow", 
                function() {
                    at_sms.t.setDisplay("show");
                    at_infoTrace.hide()
                })], true);
                at_sms.t.setDisplay("hide");
                return
            }
            at_loading.show();
            $.post(path + "/message/send", {
                title: at_sms.c.t.val(),
                nick: at_sms.c.u.val(),
                cont: at_sms.c.c.val()
            },
            function(json) {
                at_loading.hide();
                if (json.result){
                	at_infoTrace.show("站内信发送成功", "o", 2000);
                	at_sms.t.setDisplay("hide");
                } else{
                	at_infoTrace.show(json.message, "e", 2000);
                }
                try {
                    at_sms.onComplete(json)
                } catch(A) {}
            })
        }), at_sms.t.getButton("关闭", "gray", 
        function() {
            at_sms.t.setDisplay("hide")
        })]);
        at_sms.t.setWidth(350);
        var A = $("#at_sms");
        at_sms.c.t = A.find("input:eq(0)");
        at_sms.c.u = A.find("input:eq(1)");
        at_sms.c.c = A.find("textarea");
        at_sms.c.t.focus(function() {
            if (at_sms.c.t.val().replace(/\s/g, "") == "输入站内信标题") at_sms.c.t.val("")
        });
        at_sms.c.u.focus(function() {
            if (at_sms.c.u.val().replace(/\s/g, "") == "输入收信人昵称") at_sms.c.u.val("")
        });
        at_sms.c.t.blur(function() {
            if (at_sms.c.t.val().replace(/\s/g, "") == "") at_sms.c.t.val("输入站内信标题")
        });
        at_sms.c.u.blur(function() {
            if (at_sms.c.u.val().replace(/\s/g, "") == "") at_sms.c.u.val("输入收信人昵称")
        });
        at_sms(C)
    } else {
        at_sms.c.t.val("输入站内信标题");
        at_sms.c.u.val("输入收信人昵称");
        at_sms.c.c.val("");
        if (C) at_sms.c.u.val(C);
        at_sms.t.setDisplay("show")
    }
};
at_sms.t = null;
at_sms.c = {
    t: null,
    u: null,
    c: null
};
var at_ann = function(D, A) {
    if (at_userData() == null) {
        function B() {
            at_ann(D, A)
        }
        at_loginNeed(B, B);
        return
    }
    var E = $(D),
    C = E.text();
    E.html("<u></u>加载中");
    $.getJSON("http://quan.zhubajie.com/api/attent.html?jsoncallback=?", {
        uid: A
    },
    function(B) {
        if (B.state == 1) E.html("<u></u>取消关注");
        else if (B.state == 2) E.html("<u></u>关注");
        else {
            E.html("<u></u>" + C);
            at_infoTrace.show(B.msg, "e")
        }
        try {
            at_ann.onComplete(B)
        } catch(A) {}
    })
},
at_sre = function(A, C) {
    if (at_userData() == null) {
        function B() {
            at_sre(A, C)
        }
        at_loginNeed(B, B);
        return
    }
    if (at_sre.t == null) {
        at_loading.show();
        $.getJSON("http://quan.zhubajie.com/api-share.html?jsoncallback=?", {
            mode: "sre",
            id: A,
            type: C
        },
        function(B) {
            at_loading.hide();
            if (B.state == 1) {
                var D = "<div id=\"at_sre\" class=\"at_tol_pub\"><p class=\"sre_infos\">" + B.msg + "</p><p class=\"sre_content\"><textarea>我的分享理由是...</textarea></p></div>";
                at_sre.t = new at_trace();
                at_sre.t.setContact("分享到猪圈", D, [at_sre.t.getButton("分享", "yellow", 
                function() {
                    var B = at_sre.c.c.val().replace(/\s/g, "");
                    if (B == "" || B == "我的分享理由是...") {
                        at_infoTrace.show("分享理由不能为空", "e", null, [at_traces_i.getButton("返回重填", "gray", 
                        function() {
                            at_sre.t.setDisplay("show");
                            at_infoTrace.hide()
                        })]);
                        at_sre.t.setDisplay("hide");
                        return
                    } else at_sre.send(A, C, B)
                }), at_sre.t.getButton("取消", "gray", "close")]);
                at_sre.t.setWidth(350);
                at_sre.c.t = $("#at_sre");
                at_sre.c.i = at_sre.c.t.children("p.sre_infos");
                at_sre.c.c = at_sre.c.t.find("textarea");
                at_sre.c.c.focus(function() {
                    if (at_sre.c.c.val().replace(/\s/g, "") == "我的分享理由是...") at_sre.c.c.val("")
                });
                at_sre.c.c.blur(function() {
                    if (at_sre.c.c.val().replace(/\s/g, "") == "") at_sre.c.c.val("我的分享理由是...")
                });
                at_sre(A, C)
            } else at_infoTrace.show(B.msg, "e")
        })
    } else {
        at_sre.c.c.val("我的分享理由是...");
        at_sre.t.setDisplay("show")
    }
};
at_sre.t = null;
at_sre.c = {
    t: null,
    i: null,
    c: null
};
at_sre.send = function(A, B, C) {
    at_loading.show();
    $.getJSON("http://quan.zhubajie.com/api-share.html?jsoncallback=?", {
        mode: "sre_send",
        id: A,
        type: B,
        msg: C
    },
    function(B) {
        at_loading.hide();
        if (B.state == 1) {
            at_infoTrace.show("分享成功", "o", 2000);
            at_sre.t.setDisplay("hide")
        } else at_infoTrace.show(B.msg, "e");
        try {
            at_sre.onComplete(B)
        } catch(A) {}
    })
};
function at_fav(E, A, G) {
    if (at_userData() == null) {
        function B() {
            at_fav(E, A, G)
        }
        at_loginNeed(B, B);
        return
    }
    var F = $(E),
    D = F.text(),
    C = function() {
        switch (G) {
        case "shop":
            return "店铺";
            break;
        case "works":
            return "作品";
            break;
        case "service":
            return "服务";
            break;
        case "task":
            return "任务";
            break;
        case "attatch":
            return "稿件";
            break
        }
    } ();
    if (F.text() == "已收藏" || F.attr("favoriteState") == "true") at_infoTrace.show("此" + C + "已被您收藏过。<span style=\"display:block\"><a href=\"http://u.zhubajie.com/myfav/task\" class=\"blue1\" style=\"text-decoration:underline\" target=\"_blank\">到我的收藏夹去看看<span>", "i", null, null, true);
    else at_infoTrace.show("是否收藏该" + C + "?", "i", null, [at_traces_i.getButton("确定", "yellow", 
    function() {
        F.html("<u></u>加载中");
        $.getJSON("http://shop.zhubajie.com/api/addtofav?jsoncallback=?", {
            id: A,
            type: G
        },
        function(B) {
            if (B.state == 1) {
                at_infoTrace.show("收藏成功!<span style=\"display:block\"><a href=\"" + B.link + "\" class=\"blue1\" style=\"text-decoration:underline\" target=\"_blank\">查看我收藏的所有" + B.type + "</a></span>", "o", null, null, true);
                F.html("<u></u>已收藏")
            } else at_infoTrace.show(B.msg, "e");
            try {
                at_ann.onComplete(B)
            } catch(A) {}
        })
    }), at_traces_i.getButton("取消", "gray", "close")])
}
